package com.ruoyi.goods.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.goods.domain.BmGoods;
import com.ruoyi.goods.domain.BmSpecification;
import com.ruoyi.goods.service.BatchListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @Author {那蓝桉}
 * @Date: 2023/08/07/ 9:18
 * @description
 */
@RestController
@RequestMapping("/batchList")
public class BatchListController extends BaseController {
    @Autowired
    private BatchListService batchListService;
    @GetMapping("/list")
    public TableDataInfo list(BmGoods bmGoods)
    {
        startPage();
        List<BmSpecification> list = batchListService.getBatchList(bmGoods);
        return getDataTable(list);
    }
    @GetMapping( "/upShelves/{ids}")
    public AjaxResult updateIsShelves1(@PathVariable Long[] ids) throws IOException {
        return AjaxResult.success(batchListService.updateIsShelves1(ids));
    }
    @GetMapping( "/downShelves/{ids}")
    public AjaxResult updateIsShelves0(@PathVariable Long[] ids) throws IOException {
        return AjaxResult.success(batchListService.updateIsShelves0(ids));
    }
    @GetMapping( "/selectGoodsId/{goodsId}")
    public AjaxResult selectGoodsId(@PathVariable Long goodsId)
    {
        return AjaxResult.success(batchListService.selectGoodsId(goodsId));
    }
}
